package org.cos.verification.automata;

import java.util.Enumeration;
import java.util.Vector;


public class AutomataBuilder {
	private Automata __automata = null;
	public AutomataBuilder() {
        __automata = new Automata();
        System.out.println("DEBUG:" + __automata);
    }
	
   public void set_state(int state_id, boolean isInit, boolean isFinal) {
	   __automata.add_state(state_id);
	   if (isFinal) {
		   __automata.set_final(state_id);
	   }
	   if (isInit) {		   
		   __automata.set_init(state_id);
	   }
   }

   public void build_transition(int src_id, int dst_id, Method method, Vector conds, Vector actions) {
	   //__automata.add_state(src_id).add_state(dst_id);
	   Transition tran = new Transition(method , conds, actions);
	   //DEBUG System.out.println("Add Trans: " + src_id +"->" + dst_id + ":" + method);
	   __automata.set_transition(src_id, dst_id, tran);

   }
   public void build_name(String name) {
      __automata.name = name;
   }
   
   public Automata get_automata() {
       return __automata;
   }
}
